{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row">
                <!--搜索框开始-->
                <div class="col-sm-12">
                    <div class="layui-form layui-form-item">
                        <div class="layui-input-inline layui-form">
                            <select name="type" lay-search="">
                                <option  value="">不限订单类型</option>
                                <option  value="1">扫码订单</option>
                                <option  value="2">普通订单</option>
                            </select>
                        </div>
                        <div class="layui-input-inline layui-form">
                            <select name="role" lay-search="">
                                <option  value="">不限类型</option>
                                <option  value="1">积分订单</option>
                                <option  value="2">现金订单</option>
                            </select>
                        </div>
                        <div class="layui-input-inline layui-form">
                            <select name="status" lay-search="">
                                <option  value="">不限状态</option>
                                <option  value="1">待付款</option>
                                <option  value="2">待发货</option>
                                <option  value="3">待收货</option>
                                <option  value="4">待评价</option>
                                <option  value="5">已完成</option>
                                <option  value="6">退款/售后</option>
                                <option  value="11">退货退款</option>
                                <option  value="12">交易关闭</option>
                            </select>
                        </div>
                        <div class="layui-input-inline layui-form">
                            <select name="o_m_type" lay-search="">
                                <option  value="">不限订单来源</option>
                                <option  value="1">普通订单</option>
                                <option  value="2">产品池订单</option>
                                <option  value="3">产品池团团赚订单</option>
                            </select>
                        </div>
                        <div class="layui-col-md6 layui-input-inline">
                            <input type="text" id="key" class="layui-input search" name="key" value="" placeholder="用户名/手机号/订单号"/>
                        </div>
                        <div class="layui-input-inline">
                            <button class="layui-btn" lay-submit="" lay-filter="LAY-search">立即搜索</button>
                            <button  class="layui-btn layui-btn-normal" id="empty"  lay-submit="" lay-filter="LAY-search">重置</button>
                        </div>
                    </div>
                </div>
                <!--搜索框结束-->
            </div>
            <div class="hr-line-dashed"></div>

            <div class="example-wrap">
                <div class="example">
                    <table class="layui-hide" id="test" lay-filter="demo"></table>
                    <!--角色模板-->
                    <script type="text/html" id="titleTpl">
                        {{# if(d.o_third_order_num){ }}
                            现金订单
                        {{# }else{ }}
                            积分订单
                        {{# } }}
                    </script>
					<script type="text/html" id="o_jifen">
                        {{# if(d.o_third_order_num){ }}
                            0
                        {{# }else{ }}
                            {{d.o_jifen}}
                        {{# } }}
                    </script>
					<script type="text/html" id="o_money">
                        {{# if(d.o_third_order_num){ }}
                            {{d.o_money}}
                        {{# }else{ }}
                            0
                        {{# } }}
                    </script>
                    <!--状态模板-->
                    <script type="text/html" id="staTpl">
                        {{# switch(d["o_status"]) { case 1: }}
                            待付款
                        {{# break; case 2: }}
                            待发货
                        {{# break; case 3: }}
                            待收货
                        {{# break; case 4: }}
                            待评价
                        {{# break; case 5: }}
                            已完成
                        {{# break; case 6: }}
                            退款/售后
                        {{# break; case 11: }}
                            退货退款
                        {# break; case 12: }}
                            交易关闭
                        {{# break; } }}
                    </script>
                    <script type="text/html" id="o_m_type">
                        {{# switch(d["o_m_type"]) { case 1: }}
                            普通订单
                        {{# break; case 2: }}
                            产品池订单
                        {{# break; case 3: }}
                            产品池团团赚订单
                        {{# break; } }}
                    </script>
                    <script type="text/html" id="cateTpl">
                        {{# switch(d["o_cate"]) { case 1: }}
                        包邮
                        {{# break; case 2: }}
                        到店自提
                        {{# break; case 3: }}
                        邮费
                        {{# break; case 4: }}
                        到店消费
                        {{# break; } }}
                    </script>
                    <!-- 付款方式 -->
                    <script type="text/html" id="paytypeTpl">
                        {{#  if(d.o_pay_type == 1){ }}
                            <span>支付宝</span>
                        {{#  } else if(d.o_pay_type == 2) { }}
                            <span>微信</span>
                        {{#  } else { }}
                            <span>余额</span>
                        {{#  } }}
                    </script>
                    <!--操作模板-->
                    <script type="text/html" id="opeBar">
                        {{# if(d.o_id != ''){ }}
                        <a href="javascript:;" onclick="wk.href('{:url('orderInfo')}?id={{d.o_id}}')" class="btn btn-primary btn-xs m-r-xs" >查看详情</a>
                        {{# } }}
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    //layui渲染数据表格
    layui.use('table', function () {
        var table = layui.table
            , form = layui.form;
        table.render({
            elem: '#test'
            , url: '{:url("Order/index")}'
            ,response: {
                statusCode: 220 //成功的状态码，默认：0
            }
            , page: true
            , size: 'lg' //sm小尺寸的表格 lg大尺寸
            , cellMinWidth: 150
            , limits: [5, 10, 15, 20, 25, 30]
            , limit: "{:config('pages')}"
            , loading: true
            , id: 'testReload'
            , cols: [[
                {type:'numbers', width: 80, title: '序号'}
                , {field: 'type', width: '', title: '订单类型', align: 'center'}
                , {field: 'user_username', width: '', title: '用户名', align: 'center'}
                , {field: 'user_phone', width: '', title: '手机号', align: 'center'}
                , {field: 'o_order_num', width: '', title: '订单号', align: 'center'}
                , {field: 'o_type', width: '', title: '类型',  align: 'center',templet:"#titleTpl"}
                , {field: 'o_shop_name', width: '', title: '店铺名', align: 'center'}
                , {field: 'o_money', width: '', title: '订单总金额',  align: 'center',templet:"#o_money"}
                , {field: 'o_jifen', width: '', title: '订单总积分', align: 'center',templet:"#o_jifen"}
                , {field: 'o_third_order_num', width: '', title: '返回单号', align: 'center'}
                , {field: 'o_cate', width: '', title: '配送方式', align: 'center',templet:"#cateTpl"}
                , {field: 'o_express', width: '', title: '快递公司', align: 'center'}
                , {field: 'o_express_num', width: '', title: '快递单号', align: 'center'}
                , {field: 'o_add_time', width: '', title: '下单时间', align: 'center'}
                , {field: 'o_pay_type', width: '', title: '支付方式', align: 'center',templet:"#paytypeTpl"}
                , { width: '', title: '支付状态', align: 'center',templet:"<div>{{# if(d.o_pay_status==1){ }}未支付{{# }else{ }}已支付{{# } }}</div>"}
                , {field: 'o_status', width: '', title: '状态', align: 'center',templet:"#staTpl"}
                , {field: 'o_m_type', width: '', title: '订单来源', align: 'center',templet:"#o_m_type"}
                , {fixed: 'right', width: 100, title: '操作', align: 'center', toolbar: '#opeBar'}
            ]]
        });
    });
</script>
</body>
</html>